home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Languguage OS 2
/
Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO
/
language
/
asa
/
makefile
< prev
next >
Wrap
Makefile
|
1994-10-23
|
10KB
|
299 lines
## $Id: Makefile,v 4.2 1994/10/23 23:35:06 ingber Exp ingber $
## ********************************************************************
## Please first read README, then examine this Makefile and CHANGES.
## ********************************************************************
MANIFEST = \
ASA \
ASA/README \
ASA/CHANGES \
ASA/Makefile \
ASA/NOTES \
ASA/COPYING \
ASA/README.ps \
ASA/readme.ms \
ASA/test_asa \
ASA/test_usr \
ASA/user.c \
ASA/user.h \
ASA/asa.c \
ASA/asa.h \
ASA/asa_user.h \
ASA/asa_opt \
ASA/README+.uu
###
### USER OPTIONS
### The policy is to try to have the asa module (not necessarily
### the user module) compile without "errors" (not necessarily without
### "warnings"). Some additional modifications may be needed on your
### machine; e.g., you might have to comment out the `#include <stdlib.h>'
### lines in asa_user.h. See the current NOTES file for any updates on
### some standard implementations.
###
## Defaults for various options are given below. These can be
## overridden using DEFINE_OPTIONS. If you include several options,
## separate them by a white space or place them conveniently on several
## lines; if the latter, be sure each line to be continued ends in a "\"
## (backslash).
## This will run the ASA problem.
DEFINE_OPTIONS = -DOPTIONS_FILE=TRUE -DASA_TEST=TRUE
##
## This ASA_TEMPLATE will run the ASA test problem multiple times, and
## separate the runs into different files.
#DEFINE_OPTIONS = -DOPTIONS_FILE=FALSE -DUSER_ASA_OUT=TRUE \
#-DTIME_CALC=TRUE -DASA_TEST=TRUE -DASA_TEMPLATE=TRUE
##
## This ASA_TEMPLATE illustrates the use of SELF_OPTIMIZE=TRUE.
#DEFINE_OPTIONS = -DSELF_OPTIMIZE=TRUE -DOPTIONAL_DATA=TRUE \
#-DUSER_ASA_OUT=TRUE -DASA_TEST=TRUE -DASA_TEMPLATE=TRUE
##
## This will run the ASA_SAMPLE problem
#DEFINE_OPTIONS = -DOPTIONS_FILE=TRUE -DASA_TEMPLATE=TRUE -DASA_SAMPLE=TRUE \
#-DUSER_COST_SCHEDULE=TRUE
##
##This will run the ASA_PARALLEL code
#DEFINE_OPTIONS = -DOPTIONS_FILE=TRUE -DASA_TEST=TRUE -DASA_TEMPLATE=TRUE \
#-DASA_PARALLEL=TRUE
##
###
### Pre-Compile Options
###
## You can elect to read in the Program Options from asa_opt by
## setting OPTIONS_FILE=TRUE. OPTIONS_FILE=TRUE can be set here or
## in asa_user.h.
#-DOPTIONS_FILE=TRUE
## Setting ASA_LIB=TRUE will facilitate your running asa() as a library
## call from another program, calling asa_main() in user.c. In the
## templates, provided, all initializations and cost function definitions
## are set up in user.c.
#-DASA_LIB=FALSE
## If you do _not_ have an ANSI compiler set this to FALSE.
## If you use HAVE_ANSI=FALSE, change CC and CDEBUGFLAGS below.
#-DHAVE_ANSI=TRUE
## Some machines do not like any other I/O prototyping other than those
## in their own include files, e.g., like one convex that was tested.
## Other machines, like a Dec-3100 under Ultrix complained that the ANSI
## I/O prototypes were inconsistent. A Sun under gcc gave warnings if no
## I/O prototypes were present. Therefore, the defaults in asa_user.h and
## asa.h use K&R system prototypes even for the ANSI compiler, for
## fprintf, fflush, fclose, and exit, and for fscanf in user.h. Setting
## IO_PROTOTYPES=FALSE will comment out even these declarations.
#-DIO_PROTOTYPES=TRUE
## Some systems do not have the time include files used here; others
## have different scales for time. Setting TIME_CALC=TRUE will permit
## use of the time routines.
#-DTIME_CALC=FALSE
## Some systems, e.g., hpux, use other Unix-standard macros to access
## time. Setting TIME_STD=TRUE when using TIME_CALC=TRUE will use these
## time routines instead.
#-DTIME_STD=FALSE
## Some smaller systems choke on `long int' and this option can be
## set to INT_LONG=FALSE to turn off warnings and possibly some errors.
#-DINT_LONG=TRUE
## Some machine may not permit the dimension of calloc be anything
## but int; in this case define INT_ALLOC=TRUE. The default of FALSE
## is to set the dimension to that of LONG_INT, determined by INT_LONG.
#-DINT_ALLOC=FALSE
## You can define SMALL_FLOAT to better correlate to your own machine's
## maximum precision here if you know it.
#-DSMALL_FLOAT=1.0E-18
## You can define your own machine's minimum positive doubles here
## if you know it.
#-DMIN_DOUBLE=SMALL_FLOAT
## You can define your own machine's maximum doubles here if you
## know it.
#-DMAX_DOUBLE=1.0/SMALL_FLOAT
## You can define your own machine's maximum precision here if you
## know it.
#-DEPS_DOUBLE=SMALL_FLOAT
## When parameter temperatures are less than SMALL_FLOAT, do not exit,
## and set them to SMALL_FLOAT.
#-DNO_PARAM_TEMP_TEST=FALSE
## When the cost temperature is less than SMALL_FLOAT, do not exit,
## and set it to SMALL_FLOAT.
#-DNO_COST_TEMP_TEST=FALSE
## You can try to use asa to self-optimize its own Program Options
## be setting SELF_OPTIMIZE=TRUE. This can be very CPU-expensive as
## well as being dependent on your definition of recur_cost_function.
#-DSELF_OPTIMIZE=FALSE
## To use the ASA test problem, set ASA_TEST to TRUE.
#-DASA_TEST=FALSE
## To use testing templates in the user.c and asa.c files, associated
## with several OPTIONS, set ASA_TEMPLATE to TRUE.
#-DASA_TEMPLATE=FALSE
## It can be useful to return additional information to the user
## module from the asa module. When OPTIONAL_DATA is set to TRUE, an
## additional pointer, *asa_data, is available in DEFINES *OPTIONS to
## gather such data.
#-DOPTIONAL_DATA=FALSE
## The function used for the cost_function temperature schedule is of
## the form test_temperature in asa.c. You can define your own function
## of test_temperature adaptively in user.c in user_cost_schedule() (and
## in recur_user_cost_schedule() if SELF_OPTIMIZE is TRUE) by setting
## USER_COST_SCHEDULE to TRUE.
#-DUSER_COST_SCHEDULE=FALSE
## The macro used for reannealing parameter temperatures
## #define REANNEAL_FUNCTION(temperature, tangent, max_tangent) \
## (temperature * (max_tangent / tangent))
## is defined in asa.h. If you wish to adaptively control this function
## it can be defined in user.c in user_reanneal() (and in
## recur_user_reanneal() if SELF_OPTIMIZE is TRUE) by setting
## USER_REANNEAL_FUNCTION to TRUE.
#-DUSER_REANNEAL_FUNCTION=FALSE
## When ASA_SAMPLE is set to TRUE, data is collected by asa to
## importance-sample the users' variable space.
#-DASA_SAMPLE=FALSE
## When ASA_PARALLEL is set to TRUE, ASA is run in parallel-processor
## mode.
#-DASA_PARALLEL=FALSE
###
### Printing Options
###
## Setting ASA_PRINT to FALSE will suppress all printing within asa.
#-DASA_PRINT=TRUE
## The name of the output file containing all printing from asa If you
## wish to attach a process number use ASA_OUT=\"asa_out_$$$$\" If
## ASA_OUT=\"STDOUT\" then ASA will print to stdout.
#-DASA_OUT=\"asa_out\"
## If your wish to have the printing from asa be sent to a file
## determined dynamically from the user module, set USER_ASA_OUT to
## TRUE, and define the Program Option *asa_out_file in the user module.
## (This overrides any ASA_OUT settings.) In user.c, if
## USER_OPTIONS->asa_out_file = "STDOUT";, then ASA will print to stdout.
#-DUSER_ASA_OUT=FALSE
## Setting ASA_PRINT_INTERMED to FALSE will suppress intermediate
## printing within asa.
#-DASA_PRINT_INTERMED=TRUE
## Setting ASA_PRINT_MORE to TRUE will print out more intermediate
## information, e.g., new parameters whenever a new minimum is reported.
#-DASA_PRINT_MORE=FALSE
###
### Compiler Choices
###
## If HAVE_ANSI=TRUE use this block; otherwise, use the K&R block below.
## The gnu C compiler is the default. On Pyramid machines, you likely
## must add -Xa to CDEBUGFLAGS to use the HAVE_ANSI=TRUE (default) option.
#CC = g++
CC = gcc
CDEBUGFLAGS = -g -O -Wall
## If you wish to include some profile statistics
#CDEBUGFLAGS = -g -O -pg -Wall
##
## If you use your system's ANSI compiler, e.g., named cc, use this block.
## Sun's ANSI compiler is named acc, so use CC = acc for this one.
#CC = acc
#CDEBUGFLAGS = -O
## If HAVE_ANSI=FALSE use this K&R block.
#CC = cc
#CDEBUGFLAGS = -O
CFLAGS = $(CDEBUGFLAGS) $(DEFINE_OPTIONS)
all:
make compile
make run
# make profile
###
### Document Formatting
###
doc:
## Use groff if you have it; add pep or colcrt to delete extra
## formatting. Under groff, using `more' or `less' presents an enhanced
## text. Otherwise, standard UNIX macros are fine.
groff -wall -R -t -Tascii -mgs readme.ms > README+
pep README+ > README
uuencode README+ README+ > README+.uu
/bin/rm README+
## The next 2 lines use standard UNIX utilities
# refer -e -P -n readme.ms | tbl | nroff -ms > README+
# refer -e -P -n readme.ms | tbl | nroff -ms | colcrt > README
##
## Similarly, you may format your own PostScript README.ps.
##
groff -wall -R -t -e -mgs readme.ms > README.ps
## if you format ps with Sun's NeWSprint,
# refer -e -P -n readme.ms | tbl | eqn | troff -ms -t | \
#pl --r --e "" :opost > README.ps
###
### Other Standard Arguments to Make
###
USEROBJS = user.o # the name of the calling object file
ASAOBJS = asa.o # the ASA optimization object file
ASA_USER_INCL = asa.h user.h
compile: $(USEROBJS) $(ASAOBJS)
@$(CC) $(LDFLAGS) -o asa_run $(USEROBJS) $(ASAOBJS) -lm
## test for memory leaks
#compile: $(USEROBJS) $(ASAOBJS)
# @$(CC) $(LDFLAGS) -o asa_run $(USEROBJS) $(ASAOBJS) /usr/local/lib/leak.o -lm
$(USEROBJS): user.h
$(ASAOBJS): asa.h
$(ASA_USER_INCL): asa_user.h
profile:
gprof -z asa_run > asa_profile
## CC and CFLAGS are passed into main, to be recorded in user_out.
## use a low value of nice for runs that are time- and CPU-intensive.
run:
asa_run $(CC) $(CFLAGS)
# nice -19 asa_run $(CC) $(CFLAGS)
# profile
clean:
rm -f *\.o asa_run # core gmon.out
realclean:
rm -f *\.o asa_run user_out asa_out* # core gmon.out
docclean:
rm -f README README.ps
## This shar is the comp.sources.unix/volume15/cshar version.
shar:
(cd .. ; shar -o ASA-shar $(MANIFEST))
## Some versions of shar require a -f instead of -o.
# (cd .. ; shar -f ASA-shar $(MANIFEST))
tgz:
(cd .. ; tar cBf - ASA | gzip --best > ASA.tar.gz)